/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.core.service.jdbc;

/**
 * 
 * @author 刘威
 */
public class SQLElement {

	public static final String TYPE_STRING = "$";
	public static final String TYPE_NUMBER = "#";
	public static final String TYPE_DATE = "@";
	public static final String TYPE_BOOLEAN = "&";
	private String fieldName = "";
	private String fieldType = "$";

	public SQLElement() {
	}

	public SQLElement(String fieldName) {
		setfieldName(fieldName);
		setfieldType(fieldName);
	}

	public void setfieldName(String fieldName) {
		this.fieldName = fieldName;
	}

	public String getfieldName() {
		return this.fieldName;
	}

	public void setfieldType(String fieldName) {
		if (fieldName.substring(fieldName.length() - 1, fieldName.length())
				.equals(SQLElement.TYPE_DATE)) {
			this.fieldName = fieldName.substring(0, fieldName.length() - 1);
			this.fieldType = SQLElement.TYPE_DATE;

		} else if (fieldName.substring(fieldName.length() - 1,
				fieldName.length()).equals(SQLElement.TYPE_NUMBER)) {
			this.fieldName = fieldName.substring(0, fieldName.length() - 1);
			this.fieldType = SQLElement.TYPE_NUMBER;

		} else if (fieldName.substring(fieldName.length() - 1,
				fieldName.length()).equals(SQLElement.TYPE_STRING)) {
			this.fieldName = fieldName.substring(0, fieldName.length() - 1);
			this.fieldType = SQLElement.TYPE_STRING;

		} else if (fieldName.substring(fieldName.length() - 1,
				fieldName.length()).equals(SQLElement.TYPE_BOOLEAN)) {
			this.fieldName = fieldName.substring(0, fieldName.length() - 1);
			this.fieldType = SQLElement.TYPE_BOOLEAN;

		} else {
			this.fieldType = SQLElement.TYPE_STRING;
		}
	}

	public String getfieldType() {
		return this.fieldType;
	}
}
